clear;
IP = rand(4,1000);
A = rand(1,1000);
OP = transferFunction(IP,A);

net  = initializeNN(4,1);

% IPi = rand(4,2);
% Ai = rand(1,2);
% OPi = rand(1,2);
% 
% IpSize = (4 + 1);
% Ipmat = zeros(IpSize,1);

%net = newff(Ipmat,0,[ceil(2*IpSize), ceil(IpSize*0.5)]);
% net = newff([IPi;Ai],OPi,[ceil(size(IPi,1)),ceil(size(IPi,1)*0.5)]);
% %net.trainFcn = 'trainc';
% net.trainParam.epochs = 100*size(IP,2); %Maximum number of epochs to train 
% net.trainParam.goal = 0.001; %Performance goal
% net.trainParam.max_fail = 1000; %Maximum validation failures
% net.trainParam.show = NaN; %Epochs between displays (NaN for no displays)
% net.trainParam.showCommandLine = true;%Generate command-line output
% net.trainParam.showWindow = false; %Show training GUI
% net.trainParam.time = 2;%Maximum time to train in seconds
for i=1:10
    close all
    net = learnNN(net, IP, A, OP);
    %%
    val = evaluateStateActionNN( net,IP,A);
    plot(OP,val,'.')
    pause(1)
end
% hold on
% plot(val,'r')